<?php defined('BASEPATH') OR exit('No direct script access allowed');

class Module_Variables extends Module {

	public $version = '0.3.1';
	
	public function info()
	{
		return array(
			'name' => array(
				'vi' => 'Biến tuỳ chọn'
			),
			'description' => array(
				'vi' =>	'Quản lý các biến với giá trị tuỳ chọn, có thể sử dụng tại bất cứ đâu trên toàn hệ thống',
			),
			'frontend'	=> FALSE,
			'backend'	=> TRUE,
			'menu'		=> 'content'
		);
	}
	
	public function install()
	{
		$this->dbforge->drop_table('variables');
		
		$variables = "
			CREATE TABLE " . $this->db->dbprefix('variables') . " (
			  `id` int(11) NOT NULL AUTO_INCREMENT,
			  `name` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
			  `data` varchar(250) COLLATE utf8_unicode_ci DEFAULT NULL,
			  PRIMARY KEY (`id`)
			) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
		";
		
		if($this->db->query($variables))
		{
			return TRUE;
		}
	}

	public function uninstall()
	{
		//it's a core module, lets keep it around
		return FALSE;
	}

	public function upgrade($old_version)
	{
		// Your Upgrade Logic
		return TRUE;
	}
	
	public function help()
	{
		// Return a string containing help info
		// You could include a file and return it here.
		return "<h4>Overview</h4>
		<p>With the Variables module you can add simple values and display them anywhere on the site.</p>
		<h4>Adding Global Variables</h4><hr>
		<p>To use Variables simply choose a short name and assign a value. You can then embed the
			generated tag in page content, blog posts, etc. and the assigned value will be displayed.</p>";
	}
}

/* End of file details.php */
